package lipengfei.botaiframework.security.jwt.utils;

import lipengfei.botaiframework.security.jwt.userdetails.OnlineUser;
import org.springframework.security.core.context.SecurityContextHolder;

public class SecurityUtil {


    public static  OnlineUser getOnlineUser(){
         Object principal = SecurityContextHolder.getContext().getAuthentication().getPrincipal();
         return (OnlineUser) principal;
    }


    public static  Object   getOnlineUserId(){
        OnlineUser onlineUser = SecurityUtil.getOnlineUser();
         return  onlineUser.getUserId();
    }

}
